package com.manli.api.controller;

import java.util.Arrays;
import java.util.Map;
import com.manli.api.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import com.manli.api.base.annotation.Permissions;
import com.manli.api.dto.SysWechatConfig;
import com.manli.api.service.SysWechatConfigService;



/**
 * 微信配置表
 *
 * @author manli
 * @email 
 * @date 2020-04-03 14:04:33
 */
@Api(value="/syswechatconfig", tags="微信配置表")
@RestController
@RequestMapping("api/syswechatconfig")
public class SysWechatConfigController {
    @Autowired
    private SysWechatConfigService sysWechatConfigService;

    /**
     * 列表
     */
    @ApiOperation(value = "微信配置表列表",notes = "")
    @GetMapping("/list")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN_PERMISSONS)
    public Result list(@RequestParam Map<String, Object> params){
        return sysWechatConfigService.queryPage(params);
    }

    /**
     * 全部数据信息
     */
    @ApiOperation(value = "微信配置表全部数据信息",notes = "")
    @GetMapping("/all")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN_PERMISSONS)
    public Result all(){
        return sysWechatConfigService.queryAll();
    }

    /**
     * 单条信息
     */
    @ApiOperation(value = "微信配置表单条信息",notes = "微信配置表单条信息")
    @GetMapping("/info/{id}")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN_PERMISSONS)
    public Result info(@PathVariable("id") Integer id){
        return sysWechatConfigService.getById(id);
    }

    /**
     * 保存
     */
    @ApiOperation(value = "微信配置表保存",notes = "微信配置表保存")
    @PostMapping("/save")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN_PERMISSONS)
    public Result save(SysWechatConfig sysWechatConfig){
        return sysWechatConfigService.save(sysWechatConfig);
    }

    /**
     * 修改
     */
    @ApiOperation(value = "微信配置表修改",notes = "微信配置表修改")
    @PostMapping("/update")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN_PERMISSONS)
    public Result update(SysWechatConfig sysWechatConfig){
        return sysWechatConfigService.updateById(sysWechatConfig);
    }

    /**
     * 删除单条数据
     */
    @ApiOperation(value = "微信配置表删除",notes = "微信配置表删除")
    @ApiImplicitParam(name = "ids", value = "id",dataType = "int", required = true)
    @DeleteMapping("/delete")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN_PERMISSONS)
    public Result delete(Integer id){
        return sysWechatConfigService.removeById(id);
    }

    /**
     * 删除多条数据
     */
    @ApiOperation(value = "微信配置表删除",notes = "微信配置表删除")
    @ApiImplicitParam(name = "ids", value = "id数组,json字符串",dataType = "id数组,json字符串", required = true)
    @DeleteMapping("/deleteIds")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN_PERMISSONS)
    public Result deleteIds(@RequestBody Integer[] ids){
        return sysWechatConfigService.removeByIds(Arrays.asList(ids));
    }

}
